package com.minelx.statementplus.ui.form.dao;

import com.minelx.statementplus.ui.form.vo.ChildSqlBuilderPairValue;

import java.util.ArrayList;
import java.util.List;

import static java.util.Collections.unmodifiableList;

public class IChildSqlBuilderListModel extends BaseListModel<ChildSqlBuilderPairValue> {

	private final List<ChildSqlBuilderPairValue> childrenSql;

	public IChildSqlBuilderListModel() {
		childrenSql = new ArrayList<>();
	}

	@Override
	public int getSize() {
		return childrenSql.size();
	}

	@Override
	public ChildSqlBuilderPairValue getElementAt(int index) {
		return childrenSql.get(index);
	}

	@Override
	protected void append(ChildSqlBuilderPairValue element) {
		childrenSql.add(element);
	}

	@Override
	protected void remove(int index) {
		childrenSql.remove(index);
	}

	@Override
	public void removeAll() {
		childrenSql.clear();
	}

	@Override
	public List<ChildSqlBuilderPairValue> toList() {
		return unmodifiableList(childrenSql);
	}
}
